const CryptoJS = require("crypto-js");


function i_string() {
    var e, t, n, i = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", r = "0123456789";
    return e = o(6, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"),
        t = o(1, i),
        n = o(1, r),
    t + n + e;

    function o(e, t) {
        e = e || 32;
        for (var n = "", i = 0; i < e; i++)
            n += t.charAt(Math.ceil(1e3 * Math.random()) % t.length);
        return n
    }
}

function sha256(message) {
    return CryptoJS.SHA256(message).toString(CryptoJS.enc.Hex);
}
function GET_X_TIF_SIGNATURE(params) {
    s = params
    h = i_string()
    f = s + h + s;
    x_tif_signature = sha256(f)
    return x_tif_signature
}

console.log(GET_X_TIF_SIGNATURE(1739649430))
// function GET_X_TIF_SIGNATURE() {
//     s = Math.ceil((new Date).getTime() / 1e3)
//     h = i_string()
//     f = s + h + s;
//     x_tif_signature = sha256(f)
//     return x_tif_signature
// }
//
// console.log(GET_X_TIF_SIGNATURE())